Compiling Functions for Interrupt Calls

Contents|Index|Previous|Next
Compiling functions for interrupt calls

When compiling code for certain platforms (currently the Hitachi H8/300 and the Tandem ST-2000), you can instruct {No value for "gcc"} that certain functions are meant to be called from hardware interrupts.

To mark a function as callable from interrupt, include the line, #pragma interrupt, somewhere before the beginning of the function’s definition. (For maximum readability, you might place it immediately before the definition of the appropriate function.) #pragma interrupt will affect only the next function defined; if you want to define more than one function with this property, include #pragma interrupt before each of them.

When you define a function with a #pragma interruptdeclaration, {No value for "gcc"} alters its usual calling convention in order to provide the right environment when the function is called from an interrupt. Such functions cannot be called in the usual way from your program.

You must use other facilities to actually associate these functions with particular interrupts; {No value for "gcc"} can only compile them in the appropriate way.